package com.talent.service.user.controller;

import com.talent.common.model.TalentResult;
import com.talent.model.entity.user.Integrate;
import com.talent.model.vo.SysUserVo;
import com.talent.service.base.user.UserFeign;
import com.talent.service.user.service.IIntegrateService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName：UserController
 * @Author: hszhou
 * @Date: 2025/2/27 17:42
 * @Description: 必须描述类做什么事情, 实现什么功能
 */
@RestController
@Slf4j
@RequiredArgsConstructor
public class UserController implements UserFeign {


    private final IIntegrateService integrateService;

    @GetMapping("userId/{userId}")
    @Override
    @Transactional(rollbackFor = Exception.class)
    public TalentResult<SysUserVo> userInfo(Long userId) {

        Integrate model = new Integrate();
        model.setUserId(userId);
        model.setIntegrate(10L);
        int i=20/0;
        integrateService.save(model);

//        log.info("调用user");
//        SysUserVo sysUser = new SysUserVo();
//        sysUser.setId(userId);
//        sysUser.setUsername("watson");
//
//
//
//        try {
//            TimeUnit.SECONDS.sleep(100);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        return TalentResult.success();
    }
}
